package cn.cvs.service;

import cn.cvs.dao.ResumeMapper;
import cn.cvs.pojo.Resume;
import cn.cvs.utils.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class ResumeService {
    SqlSession session = MybatisUtil.createSqlSession();
    ResumeMapper mapper = session.getMapper(ResumeMapper.class);
    public List<Resume> list(String sex){
        List<Resume>list = mapper.list(sex);
        return list;
    }
   public int add(Resume resume){
        int count = mapper.add(resume);
        if (count>0){
            session.commit();
        }else{
            session.rollback();
        }
        return count;
    }
    public int count(String telePhone){
        int count = mapper.count(telePhone);
        return count;
    }
    public int delete(int id){
        int count = mapper.delete(id);
        if (count>0){
            session.commit();
        }else{
            session.rollback();
        }
        return count;
    }
}
